package evidence.view;

import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Map;
import javax.swing.JLabel;
import evidence.model.Model;
import java.io.File;

/**
 *
 * @author Protheo
 */
public class Settings extends javax.swing.JDialog implements IPath {
    private static final long serialVersionUID = 1;
    private Map<Integer, String> nastaveni;
    private View okno;

    /** Creates new form Settings
     * @param parent
     * @param modal
     * @param nast
     */
    public Settings(java.awt.Frame parent, boolean modal, Map<Integer, String> nast) {
        super(parent, modal);
        this.nastaveni = nast;
        this.okno = (View) parent;
        initComponents();
        this.addWindowListener(new MyWindowListener(okno));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        user = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        ulozisteXLS = new javax.swing.JLabel();
        vzorXLS = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        ulozisteEVI = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        dbKlienti = new javax.swing.JLabel();
        dbUkony = new javax.swing.JLabel();

        jLabel1.setText("Nastavení uživatele:");

        jLabel2.setText("Uřivatel:");

        user.setText(this.nastaveni.get(Model.SETTINGS_USER));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(user, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(115, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(user, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addContainerGap(47, Short.MAX_VALUE))
        );

        jLabel3.setText("Nastavení cest:");

        jLabel4.setText("XLS uložiště:");

        jLabel5.setText("XLS vzor:");

        ulozisteXLS.setText(this.nastaveni.get(Model.SETTINGS_XLS));
        ulozisteXLS.setMaximumSize(new java.awt.Dimension(260, 14));
        ulozisteXLS.setMinimumSize(new java.awt.Dimension(260, 14));
        ulozisteXLS.setName("ulozisteXLS"); // NOI18N
        ulozisteXLS.setPreferredSize(new java.awt.Dimension(260, 14));
        ulozisteXLS.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectionOpen(evt);
            }
        });

        vzorXLS.setText(this.nastaveni.get(Model.SETTINGS_VZOR));
        vzorXLS.setMaximumSize(new java.awt.Dimension(260, 14));
        vzorXLS.setMinimumSize(new java.awt.Dimension(260, 14));
        vzorXLS.setName("vzorXLS"); // NOI18N
        vzorXLS.setPreferredSize(new java.awt.Dimension(260, 14));
        vzorXLS.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectionOpen(evt);
            }
        });

        jLabel8.setText("EVI uložiště:");

        ulozisteEVI.setText(this.nastaveni.get(Model.SETTINGS_EVI));
        ulozisteEVI.setMaximumSize(new java.awt.Dimension(260, 14));
        ulozisteEVI.setMinimumSize(new java.awt.Dimension(260, 14));
        ulozisteEVI.setName("ulozisteEVI"); // NOI18N
        ulozisteEVI.setPreferredSize(new java.awt.Dimension(260, 14));
        ulozisteEVI.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectionOpen(evt);
            }
        });

        jLabel10.setText("DB klienti:");

        jLabel11.setText("DB úkony:");

        dbKlienti.setText(this.nastaveni.get(Model.SETTINGS_KLIENTI));
        dbKlienti.setMaximumSize(new java.awt.Dimension(260, 14));
        dbKlienti.setMinimumSize(new java.awt.Dimension(260, 14));
        dbKlienti.setName("dbKlienti"); // NOI18N
        dbKlienti.setPreferredSize(new java.awt.Dimension(260, 14));
        dbKlienti.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectionOpen(evt);
            }
        });

        dbUkony.setText(this.nastaveni.get(Model.SETTINGS_UKONY));
        dbUkony.setName("dbUkony"); // NOI18N
        dbUkony.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                selectionOpen(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel11, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                            .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                            .addComponent(jLabel10, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
                            .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(8, 8, 8)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(dbUkony, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(dbKlienti, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ulozisteEVI, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(vzorXLS, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(ulozisteXLS, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(53, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(32, 32, 32)
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(ulozisteXLS, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(vzorXLS, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(ulozisteEVI, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(dbKlienti, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(18, 18, 18)
                            .addComponent(dbUkony))
                        .addGroup(jPanel2Layout.createSequentialGroup()
                            .addComponent(jLabel4)
                            .addGap(50, 50, 50)
                            .addComponent(jLabel8)
                            .addGap(18, 18, 18)
                            .addComponent(jLabel10)
                            .addGap(18, 18, 18)
                            .addComponent(jLabel11))))
                .addGap(19, 19, 19))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 192, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void selectionOpen(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_selectionOpen
        if (evt.getButton()==MouseEvent.BUTTON1 && evt.getClickCount()==2){
            System.out.println("dvojklik na "+((JLabel)evt.getSource()).getName());
        }
    }//GEN-LAST:event_selectionOpen

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel dbKlienti;
    private javax.swing.JLabel dbUkony;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel ulozisteEVI;
    private javax.swing.JLabel ulozisteXLS;
    private javax.swing.JTextField user;
    private javax.swing.JLabel vzorXLS;
    // End of variables declaration//GEN-END:variables

    public File getPath() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
    // End of variables declaration

    private class MyWindowListener extends WindowAdapter {
        private View okno;

        public MyWindowListener(View okno) {
            this.okno = okno;
        }

        @Override
        public void windowClosing(WindowEvent e) {
            super.windowClosing(e);
        }
    }
}
